package com.spdzen.model;

import com.baomidou.mybatisplus.activerecord.Model;
import java.util.Date;

import javax.validation.constraints.Min;

import org.hibernate.validator.constraints.NotBlank;

import com.baomidou.mybatisplus.annotations.TableField;
import com.baomidou.mybatisplus.annotations.TableName;
import com.spdzen.support.validation.AddValidGroup;
import com.spdzen.support.validation.UpdateValidGroup;
import com.baomidou.mybatisplus.annotations.TableId;
import java.io.Serializable;

/**
 * <p>
 * 后台管理系统功能（URL区别）
 * </p>
 *
 * @author accountwcx@qq.com
 * @since 2017-03-16
 */
@TableName("spd_sys_resource")
public class SysResource extends Model<SysResource> {

	private static final long serialVersionUID = 1L;

	@TableId("id")
	@Min(value = 1L, groups = { UpdateValidGroup.class })
	private Long id;
	/**
	 * 上级ID，如果没有上级的话值为0
	 */

	@TableField("parent_id")
	private Long parentId;
	/**
	 * 资源编号，唯一
	 */

	@TableField("code")
	@NotBlank(groups = { AddValidGroup.class, UpdateValidGroup.class })
	private String code;
	/**
	 * 资源名称
	 */

	@TableField("name")
	@NotBlank(groups = { AddValidGroup.class, UpdateValidGroup.class })
	private String name;
	/**
	 * 访问路径，本站是相对路径，外站是全路径
	 */

	@TableField("url")
	private String url;
	/**
	 * 资源类型，1表示菜单，2表示功能，3表示父级显示菜单（无校验功能）
	 */

	@TableField("type")
	private Integer type;
	/**
	 * 资源图标
	 */

	@TableField("icon")
	private String icon;
	/**
	 * 菜单或功能在同一级别的排序，越小越靠前，默认1000
	 */

	@TableField("sort")
	private Integer sort;
	/**
	 * 资源类别，1表示普通资源（可以查询删除修改），2表示系统默认资源（只能查询，不能删除修改），3表示系统隐藏资源（不能查询、修改、删除，只有超级用户能看到）
	 */

	@TableField("category")
	private Integer category;
	/**
	 * 操作时间
	 */

	@TableField("operate_time")
	private Date operateTime;
	/**
	 * 操作人id
	 */

	@TableField("operate_id")
	private Long operateId;

	public Long getId() {
		return id;
	}

	public SysResource setId(Long id) {
		this.id = id;
		return this;
	}

	public Long getParentId() {
		return parentId;
	}

	public SysResource setParentId(Long parentId) {
		this.parentId = parentId;
		return this;
	}

	public String getCode() {
		return code;
	}

	public SysResource setCode(String code) {
		this.code = code;
		return this;
	}

	public String getName() {
		return name;
	}

	public SysResource setName(String name) {
		this.name = name;
		return this;
	}

	public String getUrl() {
		return url;
	}

	public SysResource setUrl(String url) {
		this.url = url;
		return this;
	}

	public Integer getType() {
		return type;
	}

	public SysResource setType(Integer type) {
		this.type = type;
		return this;
	}

	public String getIcon() {
		return icon;
	}

	public SysResource setIcon(String icon) {
		this.icon = icon;
		return this;
	}

	public Integer getSort() {
		return sort;
	}

	public SysResource setSort(Integer sort) {
		this.sort = sort;
		return this;
	}

	public Integer getCategory() {
		return category;
	}

	public SysResource setCategory(Integer category) {
		this.category = category;
		return this;
	}

	public Date getOperateTime() {
		return operateTime;
	}

	public SysResource setOperateTime(Date operateTime) {
		this.operateTime = operateTime;
		return this;
	}

	public Long getOperateId() {
		return operateId;
	}

	public SysResource setOperateId(Long operateId) {
		this.operateId = operateId;
		return this;
	}

	@Override
	protected Serializable pkVal() {
		return this.id;
	}

}